package com.wealth.scsj.p_app.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wealth.scsj.p_app.R;
import com.wealth.scsj.p_app.bean.SelectUserHasBindBankCardBean;

import java.util.List;


/**
 * 银行卡图片
 */
public class BankCardPicAdapter extends BaseQuickAdapter <SelectUserHasBindBankCardBean.DataBean.ListBean,BaseViewHolder> {
    public BankCardPicAdapter(@Nullable List<SelectUserHasBindBankCardBean.DataBean.ListBean> data) {
        super(R.layout.item_bank_card_pic_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectUserHasBindBankCardBean.DataBean.ListBean item) {
        TextView defautCardTv= helper.getView(R.id.defaut_bank_card_tv);
        if (helper.getLayoutPosition()==0){
            defautCardTv.setVisibility(View.VISIBLE);
        }else {
            defautCardTv.setVisibility(View.GONE);
        }
        helper.setText(R.id.bank_name_tv,item.getUserBankCard().getBankName());
        helper.setText(R.id.bank_card_type_tv,"接口未返卡片类型");
        String cardNo = item.getUserBankCard().getCardNo();
        StringBuilder sb = new StringBuilder(cardNo);
        String str = "";
        for (int i = 0; i <cardNo.length()-4 ; i++) {
            str += "*";
        }
        sb.replace(0,cardNo.length()-4,str);
        helper.setText(R.id.bank_number_tv,sb);

    }
}